package com.cdream.basic.algorithm.leetcode.array;

import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author cdream
 * @date 10/23/21
 */
public class Question492 implements InitializingBean {
    @PreDestroy
    @PostConstruct
    public int[] constructRectangle(int area) {
        double sqrt = Math.sqrt(area);
        int i = (int)sqrt;
        while (area % i !=0){
            i--;
        }
        return  new int[]{i, area/i};
    }

    @Override
    public void afterPropertiesSet() throws Exception {

    }
}
